﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:common="clr-namespace:ResourceViewerExtension.Common"
             xmlns:resources="clr-namespace:ResourceViewerExtension.Resources"
             x:Class="ResourceViewerExtension.MainView"
             d:DesignHeight="300"
             d:DesignWidth="450"
             mc:Ignorable="d"
             Foreground="Black"
             Background="White"
             common:CommandExecuter.Command="{Binding ViewUnLoadedCommand}"
             common:CommandExecuter.OnEvent="Unloaded">
    <UserControl.Resources>
        <common:ShortenPathConverter x:Key="ShortenPathConverter" />
        <common:TextVisibilityConverter x:Key="TextVisibilityConverter" />
        <common:NotificationVisibilityConverter x:Key="NotificationVisibilityConverter" />
        <common:TypeToStringConverter x:Key="TypeToStringConverter" />

        <Style x:Key="ListBoxItemStyle1"
               TargetType="{x:Type ListBoxItem}">
            <Setter Property="HorizontalContentAlignment"
                    Value="Center" />
            <Setter Property="VerticalContentAlignment"
                    Value="Center" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                        <Grid SnapsToDevicePixels="true"
                              Margin="2">
                            <Rectangle Name="SelectionAdorner"
                                       RadiusX="3"
                                       RadiusY="3"
                                       Fill="Transparent"
                                       Stroke="#FFE4E4E4"
                                       StrokeThickness="1"
                                       HorizontalAlignment="Stretch"
                                       VerticalAlignment="Stretch" />
                            <ContentPresenter HorizontalAlignment="Center"
                                              Margin="5"
                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                              VerticalAlignment="Center" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected"
                                     Value="true">
                                <Setter TargetName="SelectionAdorner"
                                        Property="Fill"
                                        Value="#E4F9FF" />
                                <Setter TargetName="SelectionAdorner"
                                        Property="StrokeThickness"
                                        Value="2" />
                                <Setter TargetName="SelectionAdorner"
                                        Property="Stroke"
                                        Value="Gray" />
                                <Setter TargetName="SelectionAdorner"
                                        Property="Effect">
                                    <Setter.Value>
                                        <DropShadowEffect ShadowDepth="2"
                                                          Opacity="0.6"
                                                          BlurRadius="5" />
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!-- region item templates -->
        <Style x:Key="ItemTextStyle"
               TargetType="TextBlock">
            <Setter Property="FontWeight"
                    Value="Bold" />
            <Setter Property="TextTrimming"
                    Value="CharacterEllipsis" />
            <Setter Property="HorizontalAlignment"
                    Value="Center" />
            <Setter Property="Margin"
                    Value="0 15 0 0" />
            <Setter Property="Visibility"
                    Value="{Binding DataContext.ZommSliderValue, Converter={StaticResource TextVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type ListBox}, Mode=FindAncestor}}" />
            <Setter Property="MaxWidth"
                    Value="{Binding DataContext.ZommSliderValue, RelativeSource={RelativeSource AncestorType={x:Type ListBox}, Mode=FindAncestor}}" />
        </Style>

        <DataTemplate x:Key="BrushDataTemplate">
            <Grid ToolTip="{Binding Key}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <Rectangle Fill="{Binding Value}"
                           Width="{Binding DataContext.ZommSliderValue, RelativeSource={RelativeSource AncestorType={x:Type ListBox}, Mode=FindAncestor}}"
                           Height="{Binding DataContext.ZommSliderValue, RelativeSource={RelativeSource AncestorType={x:Type ListBox}, Mode=FindAncestor}}" />

                <TextBlock Text="{Binding Key}"
                           Style="{StaticResource ItemTextStyle}"
                           Grid.Row="1" />
            </Grid>
        </DataTemplate>

        <DataTemplate x:Key="ImageDataTemplate">
            <Grid ToolTip="{Binding Key}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <Image Source="{Binding Value}"
                       Width="{Binding DataContext.ZommSliderValue, RelativeSource={RelativeSource AncestorType={x:Type ListBox}, Mode=FindAncestor}}"
                       Height="{Binding DataContext.ZommSliderValue, RelativeSource={RelativeSource AncestorType={x:Type ListBox}, Mode=FindAncestor}}" />

                <TextBlock Text="{Binding Key}"
                           Style="{StaticResource ItemTextStyle}"
                           Grid.Row="1" />
            </Grid>
        </DataTemplate>

        <DataTemplate x:Key="DetailsBrushDataTemplate">
            <Grid>
                <Rectangle Fill="{Binding Value}" />
            </Grid>
        </DataTemplate>

        <DataTemplate x:Key="DetailsImageDataTemplate">
            <Grid>
                <Image Source="{Binding Value}" />
            </Grid>
        </DataTemplate>

        <common:ItemTemplateSelector x:Key="ItemTemplateSelector"
                                     BrushTemplate="{StaticResource BrushDataTemplate}"
                                     ImageTemplate="{StaticResource ImageDataTemplate}" />

        <common:DetailsItemTemplateSelector x:Key="DetailsItemTemplateSelector"
                                            BrushTemplate="{StaticResource DetailsBrushDataTemplate}"
                                            ImageTemplate="{StaticResource DetailsImageDataTemplate}" />
        <!-- endregion item templates -->

        <Style x:Key="ButtonFocusVisual">
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Rectangle Margin="2"
                                   SnapsToDevicePixels="true"
                                   Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
                                   StrokeThickness="1"
                                   StrokeDashArray="1 2" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="CloseNotificationButtonStyle"
               TargetType="{x:Type Button}">
            <Setter Property="FocusVisualStyle"
                    Value="{StaticResource ButtonFocusVisual}" />
            <Setter Property="HorizontalContentAlignment"
                    Value="Center" />
            <Setter Property="VerticalContentAlignment"
                    Value="Center" />
            <Setter Property="Padding"
                    Value="1" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid Background="Transparent">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal" />
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)"
                                                                          Storyboard.TargetName="path">
                                                <EasingColorKeyFrame KeyTime="0"
                                                                     Value="Black" />
                                            </ColorAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Pressed">
                                        <Storyboard>
                                            <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)"
                                                                          Storyboard.TargetName="path">
                                                <EasingColorKeyFrame KeyTime="0"
                                                                     Value="#FF4E4E4E" />
                                            </ColorAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Disabled" />
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Path x:Name="path"
                                  Data="M0,0 L7,7 M7,0 L0,7"
                                  Stroke="#FFD65B2D"
                                  StrokeThickness="2"
                                  HorizontalAlignment="Center"
                                  VerticalAlignment="Center" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="ClearSearchButtonStyle"
               TargetType="{x:Type Button}">
            <Setter Property="FocusVisualStyle"
                    Value="{StaticResource ButtonFocusVisual}" />
            <Setter Property="HorizontalContentAlignment"
                    Value="Center" />
            <Setter Property="VerticalContentAlignment"
                    Value="Center" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid Background="#002B1313">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal">
                                        <Storyboard>
                                            <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)"
                                                                          Storyboard.TargetName="path">
                                                <EasingColorKeyFrame KeyTime="0"
                                                                     Value="#FFDC8B6D" />
                                            </ColorAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)"
                                                                          Storyboard.TargetName="path">
                                                <EasingColorKeyFrame KeyTime="0"
                                                                     Value="#FF5E5E5E" />
                                            </ColorAnimationUsingKeyFrames>
                                            <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                                                                          Storyboard.TargetName="border">
                                                <EasingColorKeyFrame KeyTime="0"
                                                                     Value="#FFD4D4D4" />
                                            </ColorAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Pressed">
                                        <Storyboard>
                                            <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)"
                                                                          Storyboard.TargetName="path">
                                                <EasingColorKeyFrame KeyTime="0"
                                                                     Value="#FF2D2D2D" />
                                            </ColorAnimationUsingKeyFrames>
                                            <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                                                                          Storyboard.TargetName="border">
                                                <EasingColorKeyFrame KeyTime="0"
                                                                     Value="#FFD4D4D4" />
                                            </ColorAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Disabled" />
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Border x:Name="border"
                                    Background="#FFE3E9EF"
                                    CornerRadius="2"
                                    Margin="0,1,1,1" />
                            <Path x:Name="path"
                                  Data="M0,0 L7,7 M7,0 L0,7"
                                  Stroke="#FFD65B2D"
                                  StrokeThickness="3"
                                  HorizontalAlignment="Center"
                                  VerticalAlignment="Center"
                                  Stretch="UniformToFill"
                                  Margin="2,0" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!-- region Slider style -->
        <Style x:Key="SliderRepeatButtonStyle"
               TargetType="{x:Type RepeatButton}">
            <Setter Property="OverridesDefaultStyle"
                    Value="true" />
            <Setter Property="IsTabStop"
                    Value="false" />
            <Setter Property="Focusable"
                    Value="false" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type RepeatButton}">
                        <Rectangle Fill="Transparent" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="SliderThumbStyle"
               TargetType="{x:Type Thumb}">
            <Setter Property="Focusable"
                    Value="false" />
            <Setter Property="OverridesDefaultStyle"
                    Value="true" />
            <Setter Property="Height"
                    Value="14" />
            <Setter Property="Width"
                    Value="10" />
            <Setter Property="Foreground"
                    Value="Gray" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Thumb}">
                        <Canvas SnapsToDevicePixels="true">
                            <Canvas.RenderTransform>
                                <TranslateTransform X="0"
                                                    Y="2" />
                            </Canvas.RenderTransform>
                            <Path Name="ThumbPath"
                                  Data="M 134.758,44.6833L 144.76,44.6833L 144.76,36.6819L 139.842,30.4L 134.758,36.6819L 134.758,44.6833 Z "
                                  Stretch="Fill"
                                  Stroke="#FF706D6D">
                                <Path.Effect>
                                    <DropShadowEffect ShadowDepth="2"
                                                      BlurRadius="4"
                                                      Opacity="0.6" />
                                </Path.Effect>
                                <Path.Fill>
                                    <LinearGradientBrush EndPoint="1,0.5"
                                                         StartPoint="0,0.5">
                                        <GradientStop Color="Gainsboro"
                                                      Offset="0" />
                                        <GradientStop Color="Gainsboro"
                                                      Offset="1" />
                                        <GradientStop Color="#FFB4B4B4"
                                                      Offset="0.132" />
                                    </LinearGradientBrush>
                                </Path.Fill>
                            </Path>
                        </Canvas>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver"
                                     Value="true">
                                <Setter Property="Stroke"
                                        TargetName="ThumbPath"
                                        Value="Black" />
                                <Setter Property="Fill"
                                        TargetName="ThumbPath"
                                        Value="#FFB4B4B4" />
                            </Trigger>
                            <Trigger Property="IsDragging"
                                     Value="true">
                                <Setter Property="Stroke"
                                        TargetName="ThumbPath"
                                        Value="Black" />
                                <Setter Property="Fill"
                                        TargetName="ThumbPath"
                                        Value="#FFB4B4B4" />
                                <Setter Property="Effect"
                                        TargetName="ThumbPath">
                                    <Setter.Value>
                                        <DropShadowEffect BlurRadius="4"
                                                          Opacity="0"
                                                          ShadowDepth="2" />
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="ZoomSliderStyle"
               TargetType="{x:Type Slider}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Slider}">
                        <Grid>
                            <!--TickBar x:Name="TopTick" Height="4" Placement="Top" Grid.Row="0" Fill="#FFB2B2B2"/-->

                            <Path Data="M0,0 50,0 50,5 z"
                                  VerticalAlignment="Center"
                                  Stretch="UniformToFill"
                                  Margin="5,0,0,0"
                                  Fill="#FFCECECE"
                                  SnapsToDevicePixels="True"
                                  Opacity="0.5">
                                <Path.Stroke>
                                    <LinearGradientBrush EndPoint="0.5,1"
                                                         StartPoint="0.5,0">
                                        <GradientStop Color="#FF3F3F3F"
                                                      Offset="0" />
                                        <GradientStop Color="#FFC6C6C6"
                                                      Offset="1" />
                                        <GradientStop Color="#FFC6C6C6"
                                                      Offset="0.161" />
                                    </LinearGradientBrush>
                                </Path.Stroke>
                            </Path>

                            <Track x:Name="PART_Track">
                                <Track.DecreaseRepeatButton>
                                    <RepeatButton Command="{x:Static Slider.DecreaseLarge}"
                                                  Style="{StaticResource SliderRepeatButtonStyle}" />
                                </Track.DecreaseRepeatButton>
                                <Track.IncreaseRepeatButton>
                                    <RepeatButton Command="{x:Static Slider.IncreaseLarge}"
                                                  Style="{StaticResource SliderRepeatButtonStyle}" />
                                </Track.IncreaseRepeatButton>
                                <Track.Thumb>
                                    <Thumb x:Name="Thumb"
                                           Style="{StaticResource SliderThumbStyle}" />
                                </Track.Thumb>
                            </Track>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!-- endregion Slider style -->

        <Style x:Key="ExpandCollapseDetailsButtonStyle"
               TargetType="Button">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid x:Name="grid"
                              Background="#FFCACACA">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal" />
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                                                                          Storyboard.TargetName="grid">
                                                <EasingColorKeyFrame KeyTime="0"
                                                                     Value="#FF767676" />
                                            </ColorAnimationUsingKeyFrames>
                                            <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
                                                                          Storyboard.TargetName="path">
                                                <EasingColorKeyFrame KeyTime="0"
                                                                     Value="#FFB6B6B6" />
                                            </ColorAnimationUsingKeyFrames>
                                            <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
                                                                          Storyboard.TargetName="path1">
                                                <EasingColorKeyFrame KeyTime="0"
                                                                     Value="#FFB6B6B6" />
                                            </ColorAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Pressed">
                                        <Storyboard>
                                            <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                                                                          Storyboard.TargetName="grid">
                                                <EasingColorKeyFrame KeyTime="0"
                                                                     Value="#FF767676" />
                                            </ColorAnimationUsingKeyFrames>
                                            <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
                                                                          Storyboard.TargetName="path">
                                                <EasingColorKeyFrame KeyTime="0"
                                                                     Value="#FF3B3B3B" />
                                            </ColorAnimationUsingKeyFrames>
                                            <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
                                                                          Storyboard.TargetName="path1">
                                                <EasingColorKeyFrame KeyTime="0"
                                                                     Value="#FF3B3B3B" />
                                            </ColorAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Disabled" />
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <StackPanel Orientation="Horizontal"
                                        Margin="0 1"
                                        HorizontalAlignment="Center"
                                        VerticalAlignment="Center">
                                <Path x:Name="path"
                                      Data="M0,0 6,0 3,3 z"
                                      Fill="#FFEDEDED"
                                      Stretch="UniformToFill" />
                                <Path x:Name="path1"
                                      Data="M0,3 3,0 6,3 z"
                                      Margin="-2 0 0 0"
                                      Fill="#FFEDEDED"
                                      Stretch="UniformToFill" />
                            </StackPanel>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </UserControl.Resources>

    <Grid Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="7" />
            <RowDefinition Height="0"
                           MinHeight="17"
                           MaxHeight="150"
                           Name="DetailsRowDefinition" />

        </Grid.RowDefinitions>

        <TextBlock x:Name="FilePath"
                   FontFamily="Tahoma"
                   FontStretch="Normal"
                   FontWeight="Normal"
                   FontSize="10"
                   ToolTip="{Binding FilePathString}">
            <TextBlock.Text>
                <MultiBinding Converter="{StaticResource ShortenPathConverter}">
                    <Binding Path="FilePathString"
                             Mode="OneWay" />
                    <Binding Path="ActualWidth"
                             ElementName="FilePath"
                             Mode="OneWay" />
                </MultiBinding>
            </TextBlock.Text>
        </TextBlock>

        <WrapPanel HorizontalAlignment="Left"
                   Margin="5 0"
                   Grid.Row="1"
                   Orientation="Horizontal">

            <!-- region Zoom Slider -->
            <StackPanel Orientation="Horizontal"
                        Margin="0 5 20 5">
                <Slider x:Name="ZoomSlider"
                        Value="{Binding ZommSliderValue}"
                        Width="80"
                        Minimum="8"
                        Maximum="80"
                        TickPlacement="TopLeft"
                        TickFrequency="8"
                        Margin="0 0 5 0"
                        IsSnapToTickEnabled="True"
                        VerticalAlignment="Center"
                        Style="{DynamicResource ZoomSliderStyle}" />
                <StackPanel Orientation="Horizontal"
                            VerticalAlignment="Center"
                            Width="30">
                    <TextBlock Text="{Binding Value, ElementName=ZoomSlider}"
                               VerticalAlignment="Center" />
                    <TextBlock Text="x"
                               VerticalAlignment="Center" />
                    <TextBlock Text="{Binding Value, ElementName=ZoomSlider}"
                               VerticalAlignment="Center" />
                </StackPanel>
            </StackPanel>
            <!-- endregion Zoom Slider -->

            <!-- region Presets -->
            <!--<StackPanel Orientation="Horizontal"
                        Margin="0,0,20,5">
                <TextBlock Text="{x:Static resources:Resources.Presets}"
                           Margin="0 0 5 0"
                           VerticalAlignment="Center" />
                <TextBlock x:Name="textBlock"
                           VerticalAlignment="Center"
                           Padding="0"
                           Margin="0 0 7 0"><Hyperlink Foreground="Black"
                                                       common:CommandExecuter.Command="{Binding Zoom16PresetCommand}"
                                                       common:CommandExecuter.OnEvent="Click"><Run Text="16x16" /></Hyperlink></TextBlock>
                <TextBlock VerticalAlignment="Center"
                           Padding="0"
                           Margin="0 0 7 0"><Hyperlink Foreground="Black"
                                                       common:CommandExecuter.Command="{Binding Zoom32PresetCommand}"
                                                       common:CommandExecuter.OnEvent="Click"><Run Text="32x32" /></Hyperlink></TextBlock>
            </StackPanel>-->
            <!-- endregion Presets -->

            <!-- region Search Box -->
            <Grid Margin="0 5"
                  VerticalAlignment="Center">
                <TextBox Width="80">
                    <TextBox.Style>
                        <Style TargetType="{x:Type TextBox}">
                            <Setter Property="Foreground"
                                    Value="Black" />
                            <Setter Property="Text"
                                    Value="{Binding SearchString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            <Style.Triggers>
                                <MultiDataTrigger>
                                    <MultiDataTrigger.Conditions>
                                        <Condition Binding="{Binding SearchString}"
                                                   Value="" />
                                        <Condition Binding="{Binding IsFocused, RelativeSource={RelativeSource Mode=Self}}"
                                                   Value="false" />
                                    </MultiDataTrigger.Conditions>
                                    <Setter Property="Text"
                                            Value="{x:Static resources:Resources.SearchWatermark}" />
                                    <Setter Property="Foreground"
                                            Value="Gray" />
                                </MultiDataTrigger>
                            </Style.Triggers>
                        </Style>
                    </TextBox.Style>
                </TextBox>
                <Button x:Name="ClearSearchButton"
                        common:CommandExecuter.Command="{Binding ClearSearchCommand}"
                        common:CommandExecuter.OnEvent="Click"
                        Width="15"
                        HorizontalAlignment="Right">
                    <Button.Style>
                        <Style TargetType="{x:Type Button}"
                               BasedOn="{StaticResource ClearSearchButtonStyle}">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding SearchString}"
                                             Value="">
                                    <Setter Property="Visibility"
                                            Value="Hidden" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Button.Style>
                </Button>
            </Grid>
            <!-- endregion Search Box -->

        </WrapPanel>

        <!-- region Inject -->
        <Border Grid.Row="2"
                BorderThickness="0,1"
                BorderBrush="#FFD0D0D0"
                Padding="5,3">
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,0"
                                     StartPoint="0.5,1">
                    <GradientStop Color="#FFE4E4E4"
                                  Offset="0" />
                    <GradientStop Color="#FFF9F9F9"
                                  Offset="1" />
                </LinearGradientBrush>
            </Border.Background>

            <StackPanel Orientation="Horizontal"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Left">
                <Button x:Name="InjectCodeButton"
                        common:CommandExecuter.Command="{Binding InjectCodeCommand}"
                        common:CommandExecuter.OnEvent="Click"
                        Content="{x:Static resources:Resources.InjectButtonText}"
                        Margin="0 0 10 0"
                        Padding="3,1" />

                <TextBox>
                    <TextBox.Style>
                        <Style TargetType="{x:Type TextBox}">
                            <Setter Property="Foreground"
                                    Value="Black" />
                            <Setter Property="Text"
                                    Value="{Binding PrefixString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            <Setter Property="MinWidth"
                                    Value="10" />
                            <Style.Triggers>
                                <MultiDataTrigger>
                                    <MultiDataTrigger.Conditions>
                                        <Condition Binding="{Binding PrefixString}"
                                                   Value="" />
                                        <Condition Binding="{Binding IsFocused, RelativeSource={RelativeSource Mode=Self}}"
                                                   Value="false" />
                                    </MultiDataTrigger.Conditions>
                                    <Setter Property="Text"
                                            Value="{x:Static resources:Resources.InjectPrefixWatermark}" />
                                    <Setter Property="Foreground"
                                            Value="Gray" />
                                    <Setter Property="MinWidth"
                                            Value="30" />
                                </MultiDataTrigger>
                            </Style.Triggers>
                        </Style>
                    </TextBox.Style>
                </TextBox>

                <TextBlock Text="{Binding SelectedItem.Key, ElementName=MainBox}"
                           VerticalAlignment="Center" />

                <TextBox>
                    <TextBox.Style>
                        <Style TargetType="{x:Type TextBox}">
                            <Setter Property="Foreground"
                                    Value="Black" />
                            <Setter Property="Text"
                                    Value="{Binding SuffixString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            <Setter Property="MinWidth"
                                    Value="10" />
                            <Style.Triggers>
                                <MultiDataTrigger>
                                    <MultiDataTrigger.Conditions>
                                        <Condition Binding="{Binding SuffixString}"
                                                   Value="" />
                                        <Condition Binding="{Binding IsFocused, RelativeSource={RelativeSource Mode=Self}}"
                                                   Value="false" />
                                    </MultiDataTrigger.Conditions>
                                    <Setter Property="Text"
                                            Value="{x:Static resources:Resources.InjectSuffixWatermark}" />
                                    <Setter Property="Foreground"
                                            Value="Gray" />
                                    <Setter Property="MinWidth"
                                            Value="30" />
                                </MultiDataTrigger>
                            </Style.Triggers>
                        </Style>
                    </TextBox.Style>
                </TextBox>
            </StackPanel>

        </Border>
        <!-- endregion Inject -->

        <ListBox x:Name="MainBox"
                 Grid.Row="3"
                 IsSynchronizedWithCurrentItem="True"
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                 ItemContainerStyle="{StaticResource ListBoxItemStyle1}"
                 ItemsSource="{Binding EntriesCollection}"
                 common:CommandExecuter.Command="{Binding ListBoxDoubleClickCommand}"
                 common:CommandExecuter.OnEvent="MouseDoubleClick"
                 ItemTemplateSelector="{StaticResource ItemTemplateSelector}"
                 BorderThickness="0">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel Orientation="Horizontal"
                               IsItemsHost="True" />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
        </ListBox>

        <!-- region Splitter -->
        <GridSplitter Grid.Row="4"
                      ResizeDirection="Rows"
                      HorizontalAlignment="Stretch"
                      VerticalAlignment="Stretch" />
        <Rectangle  Grid.Row="4"
                    IsHitTestVisible="False"
                    Width="90"
                    Height="1"
                    Stroke="#FFBABABA"
                    StrokeDashArray="4 7"
                    StrokeDashCap="Round"
                    StrokeEndLineCap="Round"
                    StrokeLineJoin="Round"
                    StrokeStartLineCap="Round" />
        <Button Name="ExpandCollapseDetailsButton"
                Click="ExpandCollapseDetailsButton_Click"
                Grid.Row="4"
                HorizontalAlignment="Center"
                VerticalAlignment="Stretch"
                Width="35"
                Style="{StaticResource ExpandCollapseDetailsButtonStyle}" />
        <!-- endregion Splitter -->

        <!-- region Details -->
        <Grid Grid.Row="5">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <Grid Name="DetailsHeaderContainer"
                  Background="Transparent"
                  MouseLeftButtonUp="DetailsHeaderContainer_MouseLeftButtonUp">
                <TextBlock Text="{x:Static resources:Resources.DetailsExpanderText}"
                           HorizontalAlignment="Left"
                           Margin="7 0 0 0" />
            </Grid>

            <StackPanel Grid.Row="1"
                        Orientation="Horizontal">

                <ContentControl Content="{Binding SelectedItem, ElementName=MainBox}"
                                Margin="5"
                                ContentTemplateSelector="{StaticResource DetailsItemTemplateSelector}"
                                Width="{Binding ActualHeight, RelativeSource={RelativeSource Mode=Self}}" />

                <StackPanel Orientation="Vertical"
                            HorizontalAlignment="Left"
                            VerticalAlignment="Bottom"
                            Margin="0 0 0 5">
                    <TextBox Text="{Binding SelectedItem.Key, ElementName=MainBox}"
                             Background="Transparent"
                             IsReadOnly="True"
                             BorderThickness="0"
                             FontWeight="Bold"
                             HorizontalAlignment="Left"
                             FontSize="12" />
                    <TextBlock Text="{Binding SelectedItem.Value,
                                         ElementName=MainBox,
                                         Converter={StaticResource TypeToStringConverter},
                                         StringFormat=({0})}"
                               HorizontalAlignment="Left" />
                </StackPanel>
            </StackPanel>
        </Grid>
        <!-- endregion Details -->

        <!-- region Notification -->
        <Border x:Name="NotificationContainer"
                Visibility="{Binding NotificationString, Converter={StaticResource NotificationVisibilityConverter}}"
                Grid.Row="3"
                CornerRadius="0 0 5 5"
                BorderThickness="1,0,1,1"
                BorderBrush="#FFBCBCBC"
                VerticalAlignment="Top"
                HorizontalAlignment="Stretch"
                Background="#FFF3E05C"
                Padding="7 3"
                Margin="10,0">
            <Border.Effect>
                <DropShadowEffect ShadowDepth="3"
                                  Opacity="0.5" />
            </Border.Effect>
            <Grid HorizontalAlignment="Stretch">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <TextBlock x:Name="NotificationTextBlock"
                           TextWrapping="Wrap"
                           Text="{Binding NotificationString}"
                           HorizontalAlignment="Left" />

                <Button x:Name="CloseNotificationButton"
                        common:CommandExecuter.Command="{Binding CloseNotificationCommand}"
                        common:CommandExecuter.OnEvent="Click"
                        Grid.Column="1"
                        Padding="0"
                        Margin="10 0 0 0"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Right"
                        Style="{DynamicResource CloseNotificationButtonStyle}" />

            </Grid>
        </Border>
        <!-- endregion Notification -->

    </Grid>
</UserControl>
